/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdateAuthData {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = auth.AuthPersistentManager.instance().getSession().beginTransaction();
		try {
			auth.DAOFactory lDAOFactory = auth.DAOFactory.getDAOFactory();
			auth.dao.UsuarioDAO lauthUsuarioDAO = lDAOFactory.getUsuarioDAO();
			auth.Usuario lauthUsuario = lauthUsuarioDAO.loadUsuarioByQuery(null, null);
			// Update the properties of the persistent object
			lauthUsuarioDAO.save(lauthUsuario);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdateAuthData retrieveAndUpdateAuthData = new RetrieveAndUpdateAuthData();
			try {
				retrieveAndUpdateAuthData.retrieveAndUpdateTestData();
			}
			finally {
				auth.AuthPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
